#!/bin/bash 

######################################################
# file : package.sh
#   Script creates the debian installer package
#
# Author : Anil Kainikara (anilkumar911@gmail.com)
#
# This code is licenced under the GPL.
#
######################################################


VERSION="1.0beta5"
mkdir -p build/staging/
cd build/staging/

mkdir -p DEBIAN

mkdir -p opt/powerdiary2/bin
mkdir -p opt/powerdiary2/lib
mkdir -p opt/powerdiary2/conf

#copy the class and properties file.
cp ../../src/java/MakeEntry.class         opt/powerdiary2/lib/
cp ../../src/java/powerdiary2.properties  opt/powerdiary2/lib/

#Copy the gcal jars.
cp ../../lib/*.jar opt/powerdiary2/lib/

#Copy shell scripts
cp ../../src/shell/editdiary     opt/powerdiary2/bin/
cp ../../src/shell/diary_gcal.sh opt/powerdiary2/bin/
cp ../../src/shell/todo          opt/powerdiary2/bin/
cp ../../src/shell/p2expensesum  opt/powerdiary2/bin/
cp ../../src/shell/p2searchtag   opt/powerdiary2/bin/
cp ../../src/shell/p2searchtag1  opt/powerdiary2/bin/

#copy perl scripts
cp ../../src/perl/p2search.pl     opt/powerdiary2/bin/
cp ../../src/perl/diarydoby.pl     opt/powerdiary2/bin/

#Copy files related to packaging
cp ../../src/pkg/deb/control  ./DEBIAN/
cp ../../src/pkg/deb/postinst ./DEBIAN/

#Create the package
dpkg-deb --nocheck -b $PWD ../../bin/powerdiary2${VERSION}.deb
